<template>


 <table>
    <tr>
        <th>学号</th>
        <th>
            <input  type="text" v-model="info.XueHao">
        </th>
    </tr>

    <tr>
        <th>姓名</th>
        <th>
            <input  type="text"  v-model="info.Name">
        </th>
    </tr>

    <tr>
        <th>年龄</th>
        <th>
            <input  type="text"  v-model="info.Age">
        </th>
    </tr>

    <tr>
        <th>地址</th>
        <th>
            <input  type="text"  v-model="info.Address">
        </th>
    </tr>

    <tr>
        <th></th>
        <th>
            <input  type="radio" :value="true"  v-model="info.Sex">男
            <input  type="radio" :value="false"  v-model="info.Sex">女
        </th>
    </tr>

    <tr>
        <th></th>
        <th>
         <input  type="button" @click="TianJia" value="添加">
        </th>
    </tr>

 

 </table>


</template>

<script setup lang="ts">

import axios from 'axios'
import {ref} from 'vue'

const info =ref({

    XueHao:"",
    Name:"",
    Age:0,
    Address:"",
    Sex:false,

});


const TianJia=()=>(



        axios.post("https://localhost:7282/api/User/AddSt",info.value)
        .then(res=>{

                if(res.data>0)
                {
                    alert('添加成功')
                }
                else
                {
                    alert('添加失败')
                }

        })
        .catch(erroe=>{

            console.log(erroe);

        })
        




)



</script>